package main

import (
	"myapp/mysql"
	"myapp/router"
	"myapp/service"

	"github.com/labstack/echo"
	"github.com/labstack/echo/middleware"
)

func main() {
	e := echo.New()
	e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
		AllowOrigins: []string{"*"},
		AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept},
	}))

	mysql.Init()
	service.InitGlobal() // 初始化全局变量
	router.InitRouter(e) // 初始化路由树
	e.Logger.Fatal(e.Start(":1234"))
}
